.TH std::basic_osyncstream::operator= 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::basic_osyncstream::operator= \- std::basic_osyncstream::operator=

.SH Synopsis
   basic_osyncstream& operator=( std::basic_osyncstream&& other );  \fI(since C++20)\fP

   Move-assigns a synchronized output stream:

   Move-assigns the wrapped std::basic_syncbuf from the corresponding member of other
   (after this move-assignment, other.get_wrapped() returns a null pointer and
   destruction of other produces no output; any pending buffered output will be
   emitted) and move-assigns the base std::basic_ostream (this swaps all stream state
   variables except for rdbuf between *this and other)

.SH Parameters

   other - another synchronized output stream to move from

.SH Return value

   *this

.SH Example


// Run this code

 #include <iomanip>
 #include <iostream>
 #include <sstream>
 #include <syncstream>
 #include <utility>

 int main()
 {
     std::osyncstream out(std::cout);
     out << "test\\n";
     std::ostringstream str_out;
     std::osyncstream{str_out} = std::move(out); // Note that out is emitted here
     std::cout << "str_out = " << std::quoted(str_out.view()) << '\\n';
 }

.SH Output:

 test
 str_out = ""

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

      DR    Applied to              Behavior as published              Correct behavior
                       the move assignment operator was noexcept, but
   LWG 3867 C++20      std::basic_syncbuf's move assignment operator   removed noexcept
                       is not

.SH See also

   constructor   constructs a basic_osyncstream object
                 \fI(public member function)\fP
   destructor    destroys the basic_osyncstream and emits its internal buffer
                 \fI(public member function)\fP
                 calls emit() on the underlying basic_syncbuf to transmit its internal
   emit          data to the final destination
                 \fI(public member function)\fP
